package edu.gatech.cs2340.mule.model;
import java.awt.Point;
import java.io.Serializable;
import java.util.Random;


/**
 * 
 * This class will take care of calculating the buying
 * and selling prices of properties.
 * 
 * @author Keegan Nesbitt
 *
 */
public class LandOfficeInterface implements Serializable {
	private static final long serialVersionUID = 8666020886613037464L;
	
	private MuleGame game;
	private LandOffice office;
	
	/**
	 * 
	 * @param game The MuleGame object for the game
	 * @param office The LandOffice object in the game
	 */
	public LandOfficeInterface(MuleGame game, LandOffice office) {
		this.game = game;
		this.office = office;
	}
	
	/**
	 * 
	 * Calculates the buying price for a piece of property based on
	 * the round number and a random number
	 * 
	 * @return The buying price for a piece of property
	 */
	public int calculateBuyingPrice() {
		Random rand = game.getRandomNumGenerator();
		int roundNumber = game.getRoundNumber();
		
		return office.calculateBuyingPrice(rand, roundNumber);
	}
	
	/**
	 * 
	 * Calculates the selling price for a piece of property based on
	 * a random number
	 * 
	 * @return The selling price for a piece of property
	 */
	public int calculateSellingPrice() {
		Random rand = game.getRandomNumGenerator();
		
		return office.calculateSellingPrice(rand);
	}
	
	/**
	 * 
	 * @param location The location to check whether or not it is unowned
	 * @return True if the location is unowned, false otherwise
	 */
	public boolean isUnowned(Point location) {
		return office.isUnowned(location);
	}
	
	/**
	 * 
	 * The location of the map tile provided will be removed from the LandOffice's
	 * inventory of unowned land.
	 * 
	 * @param location The location of the map tile to be removed from the land office
	 */
	public void removeUnownedLand(Point location) {
		office.removeUnownedLand(location);
	}
	
	/**
	 * 
	 * The location of the map tile provided will be added to the LandOffice's
	 * inventory of unowned land.
	 * 
	 * @param location The location of the map tile to be added to the land office
	 */
	public void addUnownedLand(Point location) {
		office.addUnownedLand(location);
	}
}
